package org.jeecg.modules.htxincailiao.versions.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.htxincailiao.order.entity.HTOrder;
import org.jeecg.modules.htxincailiao.versions.entity.HTVersions;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: ht_versions
 * @Author: jeecg-boot
 * @Date:   2023-03-10 10:06:30
 * @Version: V1.0
 */
public interface HTVersionsMapper extends BaseMapper<HTVersions> {


    @Select ("<script>" +
            "SELECT * FROM ht_versions ORDER BY " +
            "CAST(SUBSTRING_INDEX(number, '.', 1) AS UNSIGNED) DESC," +
            "CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(number, '.', 2), '.', -1) AS UNSIGNED) DESC," +
            "CAST(SUBSTRING_INDEX(number, '.', -1) AS UNSIGNED) DESC " +
            "LIMIT 1" +
            "</script>")
    HTVersions queryLastVersion();


    @Select("<script>" +
            "SELECT * FROM ht_versions WHERE number=#{number}" +
            "</script>")
    HTVersions queryByNumber(@Param("number") String number);
}
